import renderUrl from './apiHost'
import store from '@/store';
import cookies from '@/libs/util.cookies'
import request from '@/plugins/request';

export const axiosPost = (url, data) => {
  return request({
    url,
    method: 'post',
    data
  });
}

export const axiosGet = (url, params) => {
  return request({
    url,
    method: 'get',
    params
  });
}

export const api = {
  post: (url, data) => {
    return request({
      url,
      method: 'post',
      data
    });
  },
  get: (url, params) => {
    return request({
      url,
      method: 'get',
      params
    });
  }
}

// const prodAdd = process.env.NODE_ADDR || ''
const userInfo = () => store.state.admin.login.userInfo.id
let path1 = renderUrl('realtimemonitor') // 8889
// let path1 = 'http://192.168.8.126:8889' // 8889

let path2 = renderUrl('systemmanagement')// 9004
// let path2 = 'http://192.168.8.126:9004'// 9004
let apiObj = {
  // 'pathB': 'http://192.168.8.126:8888',
  // 'pathB': 'http://192.168.8.132:8888',
  'pathB': renderUrl('profile'), // 本地接口
  'pathA': renderUrl('panoramahall'), // 全景大厅
  'pathD': 'http://192.168.0.194:8886' // 数据看板
}
export const chooseUrl = (url) => {
  const hash = window.location.hash.replace(/#\//, '')
  const str = hash.split('/')[0]
  if ((/http+./i).test(url)) return url
  let reg = /\*\*+/i
  if (reg.test(url)) return apiObj['pathA'] + url.replace(reg, '')
  if (str == 'mine') {
    return apiObj['pathB'] + url
  } else {
    return apiObj['pathD'] + url
  }
}
// 公共的接口
// 根据分类ID或分类名称查询代码详细用于新增界面时的下拉框
const selectPush = (params, resolve, key) => {
  let vKeys = null
  let vKeysVal = null
  for (var keys in params) {
    vKeys = keys
    vKeysVal = params[keys]
  }
  axiosGet(apiObj.pathB + `/profile/myHome/customerArchives/userEnergyArchives/cCliqueInfoManage/getBCodeValueAndName?${vKeys}=${vKeysVal}`)
    .then(res => {
      resolve(res.result)
      sessionStorage.setItem(key, JSON.stringify(res.result))
    })
}
export const getBCodeValueAndName = (params, key) => {
  return new Promise((resolve, reject) => {
    if (sessionStorage.getItem(key) != null) {
      let lentsArr = JSON.parse(sessionStorage.getItem(key))
      if (lentsArr.length > 0) {
        resolve(lentsArr)
      } else {
        selectPush(params, resolve, key)
      }
    } else {
      selectPush(params, resolve, key)
    }
  })
}
// 树接口
export const getTreeData = (params) => {
  return axiosPost(path1 + '/realtimemonitor/EquipRealTimeMonitor/listEquipRealTimeMonitorTree', params)
}
// 区域树接口(原本的旧接口替换成新的)
export const getAreaDataList = (params) => {
  return axiosGet(renderUrl("utiltools") + '/support/borgInfo/getAreaTreeByOrgNo', params)
}
export const getAreaData = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/useEnergyArchives/customerEnergyArchivesTree/selAreaTree", data))

/**
 * 获取区域(原有的/profile/customerView/listOrgNo2AreaTree接口查询出来不显示名字，数据有问题，换成新的)
 */
export const selAreaTree = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/useEnergyArchives/customerEnergyArchivesTree/selAreaTree", data))


// 获取登录用户信息接口
export const getBasicUserInfo = () => {
  return axiosGet(path2 + '/systemmanagement/auth/getBasicUserInfo')
}
// 获取登录用户权限接口 systemmanagement/auth/listMyFunctionCodes
export const listMyFunctionCodes = () => {
  return axiosGet(path2 + '/systemmanagement/auth/listMyFunctionCodes')
}
// 树接口
export const getSiteTreeData = (params) => {
  params.custId = cookies.get('custId')
  // params.custId = userInfo()
  return axiosPost(renderUrl('profile') + '/profile/myHome/customerArchives/useEnergyArchives/customerEnergyArchivesTree/selectEnergyArchivesTree', params)
}
// 树接口 新的
export const getSiteTreeDataN = (val) => {
  let params = val == undefined ? '' : val

  let custId = cookies.get('custId')

  return axiosGet(`${renderUrl('profile')}/profile/myHome/customerArchives/useEnergyArchives/customerEnergyArchivesTree/selectOfEnergyArchivesTree?nodeName=${params}&custId=${custId}`)
}
export const getSiteTreeDataS = (params) => {
  return axiosPost(`${renderUrl('profile')}/profile/myHome/customerArchives/useEnergyArchives/customerEnergyArchivesTree/myInformation/organizationTree4F`, params)
  // return axiosGet(`/profile/myHome/customerArchives/useEnergyArchives/customerEnergyArchivesTree/selectOfEnergyArchivesTree?nodeName=&custId=${params}`) 、、
}
/**
 * @description 客户档案新增查重
 * @param {*} params
 */
export const custDuplicateCheck = (params) => {
  return axiosPost(`${renderUrl('profile')}/profile/myHome/customerArchives/userEnergyArchives/customerArchivesManage/custDuplicateCheck`, params)

}
/**
 * @description 客户档案站点查重
 * @param {*} params
 */
export const siteDuplicateCheck = (params) => {
  return axiosPost(`${renderUrl('profile')}/profile/myHome/customerArchives/useEnergyArchives/customerEnergyArchivesTree/siteDuplicateCheck`, params)

}
// 客户统一视图-用能监测-能源使用监测
export const loadEnergyUseMonitor = (params) => {
  return axiosPost(path1 + '/realtimemonitor/energyMonitoring/energyRealTimeMonitoring/energyUseMonitoring', params)
}
// 客户统一视图-用能监测-能源供应异常监测/柱状图
export const energyAnomalyDetection = (params) => {
  return axiosPost(path1 + '/realtimemonitor/energyMonitoring/energyRealTimeMonitoring/energyAnomalyDetectionColumnar', params)
}

// 客户统一视图-用能监测-能源供应异常监测/分页表格
export const energyAnomalyDetectionTable = (params) => {
  return axiosPost(path1 + '/realtimemonitor/energyMonitoring/energyRealTimeMonitoring/energyAnomalyDetectionTable', params)
  // return axiosPost('http://192.168.8.108:8889/realtimemonitor/energyMonitoring/energyRealTimeMonitoring/energyAnomalyDetectionTable', params)
}

// 设备建档-资产编号是否重复
export const isExistAssetNo = (params, params1) => {
  return axiosGet(`${renderUrl('profile')}/profile/myHome/customerArchives/equipArchivesMng/equipArchives/isExistAssetNo?assetNo=${params}&equipId=${params1}`)
  // return axiosGet(`${apiObj['pathB']}/profile/myHome/customerArchives/equipArchivesMng/equipArchives/isExistAssetNo?assetNo=${params}&equipId=${params1}`)
}

// 设备建档导出excel
export const equipArchivesExportExc = apiObj['pathB'] + '/profile/myHome/customerArchives/equipArchivesMng/equipArchives/exportExcel'

// 设备参数导出excel
export const equipParaExportExc = apiObj['pathB'] + '/profile/myHome/customerArchives/equipArchivesMng/equipPara/exportExcelOfEquipPara'

// 设备类型导出excel
export const equipTypeExportExc = apiObj['pathB'] + '/profile/myHome/customerArchives/equipArchivesMng/equipType/exportExcelOfEquipType'

// 用能安全导出excel
export const energySafeExportExc = apiObj['pathB'] + '/profile/energySafe/exportExcelOfEnergySafeInfo'

// 基本信息-客户项目详细信息导出excel
export const prjInfoPageExportExc = apiObj['pathB'] + '/profile/customerView/exportExcelOfPPrjInfoPage'

// 基本信息-设备基本信息导出excel
export const basicEquExportExc = apiObj['pathB'] + '/profile/customerView/exportExcelOfEquipArchivesPage'

// 能效提升-能源单元能效分析导出excel
export const efficAnalyExportExc = apiObj['pathB'] + '/profile/customerArchives/customerView/energyEfficiencyIncrease/exportExcelOfMoEnergyUsePageByCSEId'

// 能效提升-能效对标分析导出excel
export const benchAnalyExportExc = apiObj['pathB'] + '/profile/customerArchives/customerView/energyEfficiencyIncrease/exportExcelOfMoIndustryCounterbidPage'

// 集团户档案管理导出接口
export const exportExcelOfCCliqueInfo = apiObj['pathB'] + '/profile/myHome/customerArchives/userEnergyArchives/cCliqueInfoManage/exportExcelOfCCliqueInfo'
export const getQueryString = (paramer) => {
  var url = window.location.href.split('?')[1]
  // console.log(url)
  // return false
  if (!url) {
    return false
  }
  /* 获取url里"?"后面的值 */
  if (url.indexOf('&') > 0) {
    /* 判断是否是一个参数还是多个参数 */

    urlParamArry = url.split('&')

    /* 分开每个参数，并放到数组里 */
    for (var i = 0; i < urlParamArry.length; i++) {
      var paramerName = urlParamArry[i].split('=')

      /* 把每个参数名和值分开，并放到数组里 */

      if (paramer == paramerName[0]) {
        /* 匹配输入的参数和数组循环出来的参数是否一样 */
        return paramerName[1]
        /* 返回想要的参数值 */
      }
    }
  } else {
    /* 判断只有个参数 */
    var paramerValue = url.split('=')[1]
    return paramerValue
  }
}


/**
 * @description 采集模板数据接口
 * @param {*} data
 */
export const listCpDataTemplates = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/cpDataTemplate/listCpDataTemplates", data))

export const selectDataSubType = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/cpDataRela/selectDataSubType", data))
export const selectParentDataByQuery = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/cpDataRela/selectParentDataByQuery", data))
export const saveCpDataTemplate = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/cpDataTemplate/saveCpDataTemplate", data))
export const exportListCpDataTemplates = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/cpDataTemplate/exportListCpDataTemplates", data))
export const getCpDataTemplate = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/cpDataTemplate/getCpDataTemplate", data))
export const deleteCpDataTemplate = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/cpDataTemplate/deleteCpDataTemplate", data))

/**
 * 采集任务管理
 *
*/
export const listCommuTasks = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/commuTask/listCommuTasks", data))
export const saveCommuTask = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/commuTask/saveCommuTask", data))
export const listCommuTaskIssueds = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/commuTask/listCommuTaskIssueds", data))
export const saveCommuTaskDet = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/commuTask/saveCommuTaskDet", data))
export const getCommuTask = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/commuTask/getCommuTask", data))
export const deleteCommuTask = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/commuTask/deleteCommuTask", data))
export const selectTemplateRelation = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/cpDataTemplate/selectTemplateRelation", data))
export const isRepeat = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/commuTask/isRepeat", data))
export const selectCommuResult = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/callTask/selectCommuResult", data))

/*根据采集点编号选择测量点序号 （测量点新增页面可以选择，测量点修改，采集点新增，修改直传终端测量点页面无法使用*/
export const selectSortNoMax = async (apiUrl, params, type = 'get') => {
  return api[type](`${renderUrl('profile')}/profile/myHome/customerArchives/commuArchives/measPoint/${apiUrl}`, params).then(res => res.result)
}

/**
 * 告警全局配置
*/
export const listAlarmGlobalOrg = (data) => (api.get(`${renderUrl('realtimemonitor')}/realtimemonitor/alarmStrategyMgr/listAlarmGlobalOrg`, data))
//角色
export const listRolesNoPaging = (data) => (api.get(renderUrl('systemmanagement') + "/systemmanagement/role/getRolesByUserIdOfBizz", data))
//联系人
export const getCustContactList = (data) => (api.post(renderUrl('systemmanagement') + "/systemmanagement/user/listUserByDeptAndRole", data))
//部门
export const listOrganizationsNoPaging = (data) => (api.get(renderUrl('realtimemonitor') + "/realtimemonitor/alarmStrategyMgr/listDeptByOrgNo", data))

export const getServerContactList = (data) => (api.post(renderUrl('systemmanagement') + "/systemmanagement/user/listUserByDeptAndRole", data))
// export const configAlarmRole = (data)=>(api.post(renderUrl('systemmanagement')+"/realtimemonitor/alarmStrategyMgr/configAlarmRole",data))
//保存
export const configAlarmRole = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmStrategyMgr/configAlarmStrategy", data))

/**
 *
 * 告警历史查询
 */
export const listAlarmStatisInfo = (url, data) => (api.post(renderUrl('realtimemonitor') + url, data))


/**
 * 告警项
*/
export const getEnergyItemList = (data) => (api.get(renderUrl('realtimemonitor') + "/realtimemonitor/alarmStrategyMgr/getEnergyItemList", data))
export const getDataItemList = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmStrategyMgr/getDataItemList", data))
export const getWarningInfoByDataNo = (data) => (api.get(renderUrl('realtimemonitor') + "/realtimemonitor/alarmStrategyMgr/getWarningInfoByDataNo", data))

export const alarmSubscriptionTemplate = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmManagement/alarmMessageTemplateManagement/alarmSubscriptionTemplate", data))
export const addOrUpdateInfo = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmStrategyMgr/addOrUpdateInfo", data))

/**
 * 告警模板
*/

export const alarmSubscriptionTemplateByOne = (data) => (api.get(renderUrl('realtimemonitor') + "/realtimemonitor/alarmManagement/alarmMessageTemplateManagement/alarmSubscriptionTemplateByOne/" + data))
export const alarmStateModification = (data) => (api.get(renderUrl('realtimemonitor') + "/realtimemonitor/alarmManagement/alarmMessageTemplateManagement/alarmStateModification/" + data))
export const deleteAlarmTemplate = (data) => (api.get(renderUrl('realtimemonitor') + "/realtimemonitor/alarmManagement/alarmMessageTemplateManagement/deleteAlarmTemplate/" + data))
export const alarmTemplateParam = () => (api.get(renderUrl('realtimemonitor') + "/realtimemonitor/alarmManagement/alarmMessageTemplateManagement/alarmTemplateParam"))

export const insertAlertMessageTemplate = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmManagement/alarmMessageTemplateManagement/insertAlertMessageTemplate", data))
export const updateAlarmSubscriptionTemplate = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmManagement/alarmMessageTemplateManagement/updateAlarmSubscriptionTemplate", data))

/**
 * 告警策略
*/
export const updateSAlarmTaticsStatus = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/customerAlarm/alarmTatics/updateSAlarmTaticsStatus", data))
export const aKeyToOpenOrClose = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/customerAlarm/alarmTatics/aKeyToOpenOrClose", data))
export const listAlarmTaticss = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/customerAlarm/alarmTatics/listAlarmTaticss", data))
export const getAlarmTatics = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/customerAlarm/alarmTatics/getAlarmTatics", data))
export const measPointList = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/commuArchives/measPoint/list", data))
export const saveAlarmTatics = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/customerAlarm/alarmTatics/saveAlarmTatics", data))

/*************************************告警大厅*************************************** */

/**
 * @param data  {alarmLevel: String,custId:* String,pageNum: number,pageSize: number}
* @description 告警记录(通过站点ID查看告警记录)
*/
export const getAlarmBySiteId = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/alarmStatistics/alarmMonitoringHall/getAlarmBySiteId", data))
/**
 * @param data  {alarmLevel: String,custId:* String,pageNum: number,pageSize: number}
* @description 告警记录(通过告警信息查找站点信息)
*/
export const getSiteInfoByAlarm = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/alarmStatistics/alarmMonitoringHall/getSiteInfoByAlarm", data))
/**
 * @param data  {alarmLevel: String,custId:* String,pageNum: number,pageSize: number}
* @description 告警记录导出
*/
export const exportExcelByCustId = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/alarmStatistics/alarmMonitoringHall/exportExcelByCustId", data))
/**
 * @param data  {alarmLevel: String,custId:* String,pageNum: number,pageSize: number}
* @description 今日告警记录导出
*/
export const exportExcelToday = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/alarmStatistics/alarmMonitoringHall/exportExcelToday", data))

/**
  * @param data  {pageNum: number,pageSize: number}
 * @description 今日告警记录
 */
export const listSAlarmInfosToday = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/alarmStatistics/alarmMonitoringHall/listSAlarmInfosToday", data))

/**
  * @param data  {pageNum: number,pageSize: number,alarmHandlingStatus: String}
 * @description 昨日告警记录
 */
export const listSAlarmInfosYesterday = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/alarmStatistics/alarmMonitoringHall/listSAlarmInfosYesterday", data))

/**
  * @param data  {pageNum: number,pageSize: number}
 * @description 告警次数柱状图
 */
export const sumAlarmNum = (data) => (api.get(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/alarmStatistics/alarmMonitoringHall/sumAlarmNum", data))
/**
  * @param data  {alarmTime: String}
 * @description 告警类型次数饼图
 */
export const sumTypeNum = (data) => (api.get(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/alarmStatistics/alarmMonitoringHall/sumTypeNum", data))


/**
  * @param data  {queryLx: String，queryTime: string}
 * @description 告警统计
 */
export const countAlarmNum = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/alarmStatistics/alarmMonitoringHall/countAlarmNum", data))
/**
  * @param data  {queryTime:string 查询时间段，今日：today，昨日：yesterday，本月：month；workStatus: string，workType：sring}
 * @description  监测大厅工单中心
 */
export const mhallWorkOrder = (data) => (api.post(renderUrl('operationmanagement') + "/operationmanagement/sWorkJob/mhallWorkOrder", data))
/**
  * @param data  {queryTime:string 查询时间段，今日：today，本月：month,本年：year}
 * @description  监测大厅工单柱形统计
 */
export const getWorkCount = (data) => (api.get(renderUrl('operationmanagement') + "/operationmanagement/sWorkJob/getWorkCount", data))
/**
  * @param data  {queryTime:string 查询时间段，今日：today，本月：month,本年：year}
 * @description  监测大厅工单柱形统计环比
 */
export const getWorkCountHb = (data) => (api.get(renderUrl('operationmanagement') + "/operationmanagement/sWorkJob/getWorkCountHb", data))
/**
  * @param data  {queryTime:string 查询时间段，今日：today，本月：month,本年：year}
 * @description  监测大厅工单柱形统计 同比
 */
export const getWorkCountTb = (data) => (api.get(renderUrl('operationmanagement') + "/operationmanagement/sWorkJob/getWorkCountTb", data))
/**
  * @param data  {queryTime:string 查询时间段，今日：today，本月：month,本年：year}
 * @description  监测大厅工单柱形统计 同比
 */
export const countWorkByType = (data) => (api.post(renderUrl('operationmanagement') + "/operationmanagement/sWorkJob/countWorkByType", data))
/**
  * @param data  {queryTime:string 查询时间段，今日：today，本月：month,本年：year}
 * @description  监测大厅工单柱形统计 同比
 */
export const getSWorkCount = (data) => (api.post(renderUrl('operationmanagement') + "/operationmanagement/sWorkJob/getSWorkCount", data))
/**
  * @param data  {alarmInfoId}
 * @description  告警监测 消除
 */
export const updateAlarmStatus = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmStatistics/updateAlarmStatus", data))

/**
  * @param data  {alarmInfoId}
 * @description  告警监测 消除
 */
export const hasPermission = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/alarmStatistics/alarmMonitoringHall/hasPermission", data))

/**
  * @param data  {null}
 * @description  告警监测大厅/根据登录信息获取客户信息列表
 */
export const getCBaseInfoByUserid = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/alarmStatistics/alarmMonitoringHall/getCBaseInfoByUserid", data))

/*********************告警监测****************************** */

/**
  * @param data  {null}
 * @description  告警监测列表
 */
export const selectEquipmentList = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/equipmentAlarm/selectEquipmentList", data))

/**
  * @param data  {"alarmHandlingStatus": "string",
                "custNo": "string",
                "endDate": "2019-10-16T14:12:21.777Z",
                "equipNo": "string",
                "equipType": "string",
                "monitoringState": "string",
                "pageNum": 0,
                "pageSize": 0,
                "siteNo": "string",
                "startDate": "2019-10-16T14:12:21.777Z",
                "theAlarmLevel": "string"}
 * @description  告警监测 客户列表
 */
export const getCBaseInfoEquipmentList = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/equipmentAlarm/getCBaseInfoEquipmentList", data))

/**
  * @param data  { "energyVarieties": "string",
        "equipModel": "string",
        "equipNo": "string",
        "equipStatusName": "string",
        "equipStuta": "string",
        "equipType": "string",
        "equipTypeName": "string",
        "instLoc": "string",
        "installDate": "2019-10-17T07:41:29.444Z",
        "manufacturer": "string"}
 * @description  告警监测 设备列表
 */
export const getOEquiArchivesAlarmList = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/equipmentAlarm/getOEquiArchivesAlarmList", data))

/**
  * @param data  { "energyVarieties": "string",
        "equipModel": "string",
        "equipNo": "string",
        "equipStatusName": "string",
        "equipStuta": "string",
        "equipType": "string",
        "equipTypeName": "string",
        "instLoc": "string",
        "installDate": "2019-10-17T07:41:29.444Z",
        "manufacturer": "string"}
 * @description  告警监测 设备列表
 */
export const getSiteInfoList = (data) => (api.post(renderUrl('realtimemonitor') + "/realtimemonitor/alarmMng/equipmentAlarm/getSiteInfoList", data))


/*设备档案管理 -设备参数管理*/
export const getEquipPara = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/equipArchivesMng/equipPara/getEquipPara", data))
export const deleteEquipPara = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/equipArchivesMng/equipPara/deleteEquipPara", data))
export const listEquipParas = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/equipArchivesMng/equipPara/listEquipParas", data))
export const updateEquipParaStatus = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/equipArchivesMng/equipPara/updateEquipParaStatus", data))

export const saveEquipType = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/equipArchivesMng/equipType/saveEquipType", data))

/*看板*/
export const getBCodeValueAndName1 = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/userEnergyArchives/cCliqueInfoManage/getBCodeValueAndName", data))
export const getBOrgInfoVOTree = (data) => (api.post(renderUrl('profile') + "/profile/myServiceManage/getBOrgInfoVOTree", data))
export const getOrgWorkOrderStatisticsCountList = (data) => (api.post(renderUrl('operationmanagement') + "/operationmanagement/sWorkJob/getOrgWorkOrderStatisticsCountList", data))
export const getOrgWorkOrderStatisticsEvaluateList = (data) => (api.post(renderUrl('operationmanagement') + "/operationmanagement/sWorkJob/getOrgWorkOrderStatisticsEvaluateList", data))
export const custEnergyUseDet = (data) => (api.post(renderUrl('panoramahall') + "/panoramahall/customerStatistics/custEnergyUseDet", data))
export const distributedPowerUserDetails = (data) => (api.post(renderUrl('panoramahall') + "/panoramahall/leader/distributedPowerUserDetails", data))
export const powerPlantDetails = (data) => (api.post(renderUrl('panoramahall') + "/panoramahall/leader/powerPlantDetails", data))
export const getTurbinesCumulative = (data) => (api.post(renderUrl('panoramahall') + "/panoramahall/leader/getTurbinesCumulative", data))
export const listPdGcAmtInfos = (data) => (api.post(renderUrl('panoramahall') + "/panoramahall/leader/listPdGcAmtInfos", data))

//左侧菜单
export const getNavList = (data = {}) => {
  let url = renderUrl('systemmanagement') + "/systemmanagement/auth/menu/list";
  let subUser = store.state.admin.subUser.user;
  if (subUser.custId || subUser.cliqueId || subUser.customerType) {
    if (subUser.custId) {
      data.custId = subUser.custId;
    }
    if (subUser.cliqueId) {
      data.cliqueId = subUser.cliqueId;
    }
    if (subUser.customerType) {
      data.customerType = subUser.customerType;
    }
  } else {
    url = renderUrl('systemmanagement') + "/systemmanagement/auth/mymenu/list";
  }
  return api.get(url, data)
}

//采集点设置
//export const xx = (data)=>(api.get(renderUrl('xx')+"/",data))

//客户档案信息管理-获取邀请码
export const createAndSsaveInvitationCode = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/userEnergyArchives/customerArchivesManage/createAndSsaveInvitationCode", data))
//客户档案信息管理-发送邀请码
export const sendInvitationCode = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/userEnergyArchives/customerArchivesManage/sendInvitationCode", data))

//设备类型查询
export const listEquipTypeNoPaging = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/equipArchivesMng/equipType/listEquipTypeNoPaging", data))

//设备建档管理/查询设备档案列表数据
export const listEquipArchivess = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/equipArchivesMng/equipArchives/listEquipArchivess", data))
//设备类型管理/根据设备类型标识获取已配置的设备参数集合(扩展属性)
export const listEquipParasByEquipType = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/equipArchivesMng/equipType/listEquipParasByEquipType", data))
//设备建档管理/保存设备档案信息
export const saveEquipArchives = (data) => (api.post(renderUrl('profile') + "/profile/myHome/customerArchives/equipArchivesMng/equipArchives/saveEquipArchives", data))
//设备建档管理/删除
export const deleteEquipArchives = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/equipArchivesMng/equipArchives/deleteEquipArchives", data))
// 设备建档管理/获取设备档案信息
export const getEquipArchives = (data) => (api.get(renderUrl('profile') + "/profile/myHome/customerArchives/equipArchivesMng/equipArchives/getEquipArchives", data))


//设备台账管理/查询设备台账数据
export const listoLedgerEquips = (data) => (api.post(renderUrl('profile') + "/profile/customerArchives/equipArchivesMng/oLedgerEquip/listoLedgerEquips", data))
//设备台账管理/保存设备台账信息
export const saveOrUpdate = (data) => (api.post(renderUrl('profile') + "/profile/customerArchives/equipArchivesMng/oLedgerEquip/saveOrUpdate", data))
//设备台账管理/删除设备台账信息
export const oLedgerEquipdelete = (data) => (api.get(renderUrl('profile') + "/profile/customerArchives/equipArchivesMng/oLedgerEquip/delete", data))
//设备台账管理/通过ID查找对应的设备台账信息(查看，修改)
export const findOLedgerEquipVOById = (data) => (api.get(renderUrl('profile') + "/profile/customerArchives/equipArchivesMng/oLedgerEquip/findOLedgerEquipVOById", data))

// 设备台账类型管理 --设备类型查重
export const isExitType = (data) => (api.get(renderUrl('profile') + "/profile/customerArchives/equipArchivesMng/oLedgerType/isExitType", data))


//设备台账管理/查找台账设备类型列表
export const findLedgerTypeNo = (data) => (api.get(renderUrl('profile') + "/profile/customerArchives/equipArchivesMng/oLedgerType/findLedgerTypeNo", data))
//设备台账管理/保存设备类型信息
export const saveOrUpdateType = (data) => (api.post(renderUrl('profile') + "/profile/customerArchives/equipArchivesMng/oLedgerType/saveOrUpdate", data))


//用能部门管理/部门能源单元管理 列表查询
export const selDeptUnitConfList = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/selDeptUnitConfList", data))
//用能部门管理/部门能源单元管理 查询详情
export const selDeptUnitConfDetails = (data) => (api.get(renderUrl('profile') + "/profile/systemSetup/selDeptUnitConfDetails", data))
//用能部门管理/部门能源单元管理 修改
export const updDeptUnitConf = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/updDeptUnitConf", data))
//用能部门管理/用能部门 所属部门树结构
export const selEnergyDepManageTree = (data) => (api.get(renderUrl('profile') + "/profile/systemSetup/selEnergyDepManageTree", data))
//用能部门管理/用能部门名称查重
export const deptDuplicationCheck = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/deptDuplicationCheck", data))
//用能部门管理/新增修改用能部门
export const insAndUpuEnergyDepManage = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/insAndUpuEnergyDepManage", data))
//用能部门管理/部门能源单元树结构
export const deptEnergyUnitTreeList = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/deptEnergyUnitTreeList", data))
//用能部门管理/用能部门能源单元配置(保存)
export const insDeptUnitConf = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/insDeptUnitConf", data))

//用能产线管理/产线能源单元管理 列表查询
export const selLineUnitConfList = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/selLineUnitConfList", data))
//用能产线管理/产线能源单元管理 查询详情
export const selLineUnitConfDetails = (data) => (api.get(renderUrl('profile') + "/profile/systemSetup/selLineUnitConfDetails", data))
//用能产线管理/产线能源单元管理 修改
export const updLineUnitConf = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/updLineUnitConf", data))
//用能产线管理/用能产线树结构 所属产线树结构
export const selEnergyProdLineTree = (data) => (api.get(renderUrl('profile') + "/profile/systemSetup/selEnergyProdLineTree", data))
//用能部门管理/用能产线名称查重
export const lineDuplicationCheck = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/lineDuplicationCheck", data))
//用能产线管理/新增修改用能产线
export const insAndUpuEnergyProdLine = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/insAndUpuEnergyProdLine", data))
//用能产线管理/产线能源单元树结构
export const lineEnergyUnitTreeList = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/lineEnergyUnitTreeList", data))
//用能产线管理/用能产线能源单元配置
export const insLineUnitConf = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/insLineUnitConf", data))


//用能区域管理/区域能源单元管理 查询列表
export const selAreaUnitConfList = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/selAreaUnitConfList", data))
//用能区域管理/查询区域能源单元管理详情
export const selAreaUnitConfDetails = (data) => (api.get(renderUrl('profile') + "/profile/systemSetup/selAreaUnitConfDetails", data))
//用能区域管理/修改区域能源单元管理
export const updAreaUnitConf = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/updAreaUnitConf", data))
//用能区域管理/用能区域树结构 所属区域树结构
export const selEnergyAreaTree = (data) => (api.get(renderUrl('profile') + "/profile/systemSetup/selEnergyAreaTree", data))
//用能区域管理/用能区域名称查重
export const areaDuplicationCheck = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/areaDuplicationCheck", data))
//用能区域管理/新增修改用能区域
export const insAndUpuEnergyAreaManage = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/insAndUpuEnergyAreaManage", data))
//用能区域管理/区域能源单元树结构
export const areaEnergyUnitTreeList = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/areaEnergyUnitTreeList", data))
//用能区域管理/用能区域能源单元配置
export const insAreaUnitConf = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/insAreaUnitConf", data))


//用能系统管理/系统能源单元管理 查询列表
export const selSystemUnitConfList = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/selSystemUnitConfList", data))
//用能系统管理/系统能源单元管理 查询详情
export const selSystemUnitConfDetails = (data) => (api.get(renderUrl('profile') + "/profile/systemSetup/selSystemUnitConfDetails", data))
//用能系统管理/修改系统能源单元管理
export const updSystemUnitConf = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/updSystemUnitConf", data))
//用能系统管理/用能系统树结构 所属系统树结构
export const selEnergySystemTree = (data) => (api.get(renderUrl('profile') + "/profile/systemSetup/selEnergySystemTree", data))
//用能系统管理/用能系统名称查重
export const systemDuplicationCheck = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/systemDuplicationCheck", data))
//用能系统管理/新增修改用能系统
export const insAndUpuEnergySystemManage = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/insAndUpuEnergySystemManage", data))
//用能系统管理/系统能源单元树结构
export const systemEnergyUnitTreeList = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/systemEnergyUnitTreeList", data))
//用能系统管理/用能系统能源单元配置
export const insSystemUnitConf = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/insSystemUnitConf", data))


//行业能效标杆设置/行业能效标杆分页查询
export const energyBenchmarkList = (data) => (api.post(renderUrl('substationoperation') + "/substationoperation/energyBenchmark/energyBenchmarkList", data))
//行业能效标杆设置/新增行业能效标杆
export const saveEnergyBenchmark = (data) => (api.post(renderUrl('substationoperation') + "/substationoperation/energyBenchmark/saveEnergyBenchmark", data))
//行业能效标杆设置/删除行业能效标杆
export const deleteEnergyBenchmark = (data) => (api.post(renderUrl('substationoperation') + "/substationoperation/energyBenchmark/deleteEnergyBenchmark", data))
//行业能效标杆设置/修改行业能效标杆
export const updateEnergyBenchmark = (data) => (api.post(renderUrl('substationoperation') + "/substationoperation/energyBenchmark/updateEnergyBenchmark", data))
//行业能效标杆设置/行业分类用能类别标准代码
export const tradeEnergyMap = (data) => (api.post(renderUrl('substationoperation') + "/substationoperation/energyBenchmark/tradeEnergyMap", data))


//能效分析体系管理/部门能耗计划管理
export const insEnergyDeptManage = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/energyPlanManage/insEnergyDeptManage", data))
export const selDeptEnergyPlanManagePageList = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/energyPlanManage/selDeptEnergyPlanManagePageList", data))
export const updEnergyDeptManage = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/energyPlanManage/updEnergyDeptManage", data))
export const delEnergyDeptManage = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/energyPlanManage/delEnergyDeptManage", data))

//能效分析体系管理/产线能耗计划管理
export const insEnergyLineManage = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/energyPlanManage/insEnergyLineManage", data))
export const selLineEnergyPlanManagePageList = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/energyPlanManage/selLineEnergyPlanManagePageList", data))
export const updEnergyLineManage = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/energyPlanManage/updEnergyLineManage", data))
export const delEnergyLineManage = (data) => (api.post(renderUrl('profile') + "/profile/systemSetup/energyPlanManage/delEnergyLineManage", data))

//基本参数设置/分页查询
export const selectBasic = (data) => (api.post(renderUrl('profile') + "/profile/EfficiencyAnalysisManage/select", data))
//基本参数设置/保存参数设置
export const saveBasic = (data) => (api.post(renderUrl('profile') + "/profile/EfficiencyAnalysisManage/save", data))
//基本参数设置/删除
export const deleteBasic = (data) => (api.post(renderUrl('profile') + "/profile/EfficiencyAnalysisManage/delete", data))
//基本参数设置/修改
export const updateBasic = (data) => (api.post(renderUrl('profile') + "/profile/EfficiencyAnalysisManage/update", data))
//基本参数设置/参数名称
export const paraType = (data) => (api.post(renderUrl('profile') + "/profile/EfficiencyAnalysisManage/paraType", data))
//基本参数设置/参数名称
export const selectParaType = (data) => (api.post(renderUrl('profile') + "/profile/EfficiencyAnalysisManage/selectParaType", data))

//查询套餐包功能
export const listPackage = (data) => (api.get(`${renderUrl('systemmanagement')}/systemmanagement/package/list`, data));
//新增套餐包功能
export const savePackage = (data) => (api.post(`${renderUrl('systemmanagement')}/systemmanagement/package/save`, data));
//删除套餐包功能
export const deletePackage = (data) => (api.get(`${renderUrl('systemmanagement')}/systemmanagement/package/delete`, data));

//数据召测管理——数据召测
export const saveCallTask = (data) => (api.post(`${renderUrl('profile')}/profile/myHome/customerArchives/commuArchives/callTask/saveCallTask`, data));

//获取所有角色对应的默认路由界面
export const getAllRoleHomes = (data) => (api.get(`${renderUrl('systemmanagement')}/systemmanagement/auth/listGroupDefaultFunc`, data));

//获取组织单位列表
export const getOrgList = (data) => (api.get(`${renderUrl('profile')}/profile/customerView/listOrgNo2Tree`, data));

//公告发布
export const listPageSelect = (data) => (api.post(`${renderUrl('sys')}/sys/mApplication/listPage`, data));
export const listPageDelete = (data) => (api.get(`${renderUrl('sys')}/sys/mApplication/delete`, data));
export const listPageSave = (data) => (api.post(`${renderUrl('sys')}/sys/mApplication/save`, data));
//后台要求做两个查询，此为查看接口
export const getByAInformationId = (data) => (api.get(`${renderUrl('sys')}/sys/mApplication/getByAInformationId`, data));
export const saveMIssuedAudit = (data) => (api.post(`${renderUrl('sys')}/sys/mApplication/saveMApplicationInfo`, data));
//政企角色列表
export const getGovEnterpriseRole = (data) => (api.get(`${renderUrl('systemmanagement')}/systemmanagement/functionMenu/selectGroupMenuOfBizz`, data));
//内部角色列表
export const getInternalRole = (data) => (api.get(`${renderUrl('systemmanagement')}/systemmanagement/role/listRoleTreeOfBizz`, data));
